package com.jsj.service.impl;

import com.jsj.mapper.HistoryMapper;
import com.jsj.pojo.*;
import com.jsj.service.HistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HistoryServiceImpl implements HistoryService
{

    @Autowired
    HistoryMapper historyMapper;

    @Override
    public List<DeviceHistory> queryDeviceHistory(String deviceName) {
        List<DeviceHistory> deviceHistoryList = historyMapper.queryDeviceHistory(deviceName);
        return deviceHistoryList;
    }

    @Override
    public List<BorrowHistory> queryBorrowHistory(String deviceName) {
        List<BorrowHistory> borrowHistoryList = historyMapper.queryBorrowHistory(deviceName);
        return borrowHistoryList;
    }

    @Override
    public List<RepairHistory> queryRepairHistory(String deviceName) {
        List<RepairHistory> repairHistoryList = historyMapper.queryRepairHistory(deviceName);
        return repairHistoryList;
    }


    //三个删除记录
    @Override
    public Boolean delDeviceHistoryById(int historyId) {

        Boolean flag = historyMapper.delDeviceHistoryById(historyId);
        return flag;
    }

    @Override
    public Boolean delBorrowHistoryById(int historyId) {
        Boolean flag = historyMapper.delBorrowHistoryById(historyId);
        return flag;
    }

    @Override
    public Boolean delRepairHistoryById(int historyId) {
        Boolean flag = historyMapper.delRepairHistoryById(historyId);
        return flag;
    }

    @Override
    public Boolean delAllHistory() {
        Boolean flag = historyMapper.delAllHistory();
        return flag;
    }

    //添加到历史记录
    @Override
    public Boolean addDeviceHistory(DeviceHistory device) {
        Boolean flag = historyMapper.addDeviceHistory(device);
        return flag;
    }

    @Override
    public Boolean addBorrowHistory(BorrowHistory borrow) {
        Boolean flag = historyMapper.addBorrowHistory(borrow);
        return flag;
    }

    @Override
    public Boolean addRepairHistory(RepairHistory repair) {
        Boolean flag = historyMapper.addRepairHistory(repair);
        return flag;
    }

    @Override
    public Boolean delDeviceHistory() {
        Boolean aBoolean = historyMapper.delDeviceHistory();
        return aBoolean;

    }

    @Override
    public Boolean delBorrowHistory() {
        Boolean aBoolean = historyMapper.delBorrowHistory();
        return aBoolean;

    }

    @Override
    public Boolean delRepairHistory() {
        Boolean aBoolean = historyMapper.delRepairHistory();
        return aBoolean;

    }


}
